#include <iostream>
#include <sstream>
#include "Client.h"


using namespace std;

Client::Client() : score(0)
{
    font.loadFromFile("arial.ttf");
}


sf::Socket::Status Client::receivePosition(sf::Packet& packet, TcpSocket &socket)
{
    sf::Socket::Status code =  socket.receive(packet);
    if(code == sf::Socket::Disconnected) exit(1);
    else return code;
}


Text Client::getScoreText()
{
    string scorestring;
    std::stringstream out;
    out << score;
    scorestring = out.str();

    Text text(scorestring, font, 50);
    text.setPosition(Vector2f(500, 25));
    return text;
}

void Client::increaseScore(){score+=1;}
void Client::setScore(int i){score=i;}
int Client::getScore(){return score;}
